# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName : zsj.py
# @Time     : 2024/4/13 19:09
# @Author   : Robot-Zsj
"""
description:

i:
2
1
-5 1
o:
0
"""


def getResult():
    n = int(input())

    if n < 1 or n > 100:
        print("12345")
        return

    m = int(input())

    if m < -100 or m > 100:
        print("12345")
        return

    pos = 0
    maxPos = 0
    nums = list(map(int, input().split()))

    for num in nums:

        if num < -100 or num > 100:
            print('12345')
            return

        pos += num

        if num == m:
            if num > 0:
                pos += 1
            elif num < 0:
                pos -= 1

        maxPos = max(maxPos, pos)
    print(maxPos)


getResult()
